﻿<UserControl x:Class="Analyzer.Views.MyComputerView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:ViewModels="clr-namespace:Analyzer.ViewModels;assembly=Analyzer.ViewModels" mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300">
    <UserControl.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="ResourceDictionary.xaml"/>
                <ResourceDictionary Source="ScrollViewerResourceDictionary.xaml"/>
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </UserControl.Resources>
    <Grid Margin="2,2,2,2">
        <Grid.RowDefinitions>
            <RowDefinition Height=".1*" />
            <RowDefinition Height="*" />
        </Grid.RowDefinitions> 
        <DockPanel Grid.Row="0" HorizontalAlignment="Center" Margin="2,2,2,2">
            <TextBlock Text="My Computer" FontFamily="Buxton Sketch" FontSize="20"
                                HorizontalAlignment="Center" FontWeight="Bold"/>
            <Separator Background="Transparent" BorderBrush="Transparent" Width="10"/>
            
            <ComboBox ItemsSource="{Binding Drives}" SelectedItem="{Binding SelectedDrive}" 
                      HorizontalAlignment="Left" VerticalAlignment="Center" Background="Transparent"
                      BorderBrush="Bisque" BorderThickness="1" FontFamily="Buxton Sketch"/>          
        </DockPanel>
        <DockPanel Grid.Row="1" Grid.RowSpan="2" Margin="2,2,2,2" Background="Transparent">
            <ScrollViewer  CanContentScroll="True" VerticalScrollBarVisibility="Auto" 
                           HorizontalScrollBarVisibility="Auto" MaxHeight="500" 
                           Background="Transparent" BorderBrush="Transparent">
                <TreeView  ItemsSource="{Binding FirstGeneration}" Background="Transparent" 
                           BorderBrush="Transparent" ToolTip="Select an item and click the button" >                    
                    <TreeView.ItemContainerStyle>
                        <!-- This Style binds a TreeViewItem to a PersonViewModel. -->
                        <Style TargetType="{x:Type TreeViewItem}">
                            <Setter Property="IsExpanded" Value="{Binding IsExpanded, Mode=TwoWay}" />
                            <Setter Property="IsSelected" Value="{Binding IsSelected, Mode=TwoWay}" />
                            <Setter Property="FontWeight" Value="Normal" />
                            <Style.Triggers>
                                <Trigger Property="IsSelected" Value="True">
                                    <Setter Property="FontWeight" Value="Bold" />
                                </Trigger>
                            </Style.Triggers>
                        </Style>
                    </TreeView.ItemContainerStyle>

                    <TreeView.ItemTemplate>
                        <HierarchicalDataTemplate ItemsSource="{Binding Children}" DataType="ViewModels:ParentViewModel">
                            <DockPanel Style="{StaticResource DockPanelStyle}" >
                                <TextBlock Text="{Binding Name}" FontFamily="Buxton Sketch" FontSize="20" 
                                       Style="{StaticResource TextBlockStyle}" ToolTip="{Binding ToolTipInformation}">                                    
                                </TextBlock>
                            </DockPanel>
                        </HierarchicalDataTemplate>
                    </TreeView.ItemTemplate>
                </TreeView>
            </ScrollViewer>            
        </DockPanel>       
    </Grid>
</UserControl>
